﻿using System;
using VisionCloud.Utility;

namespace VisionSurface.Web.Authorize
{
    /// <summary>
    /// 认证的秘钥、域、过期时间等认证核心配置信息
    /// </summary>
    public static class AuthCore
    {
        /// <summary>
        /// 安全秘钥
        /// </summary>
        public const string SecurityKey =
            "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDI2a2EJ7m872v0afyoSDJT2o1+SitIeJSWtLJU8/Wz2m7gStexajkeD+Lka6DSTy8gt9UwfgVQo6uKjVLG5Ex7PiGOODVqAEghBuS7JzIYU5RvI543nNDAPfnJsas96mSA7L/mD7RTE2drj6hf3oZjJpMPZUQI/B1Qjb5H3K3PNwIDAQAB";

        /// <summary>
        /// 域名地址
        /// </summary>
        public const string Domain = "http://localhost:63957";

        /// <summary>
        /// Token与Cookies的有效期，时间单位s
        /// </summary>
        private static int TotalSeconds = ConfigHelper.GetValue<int>("AccessTokenValidity") * 3600;

        /// <summary>
        /// 过期时间
        /// </summary>
        /// <returns></returns>
        public static DateTime GetExpires()
        {
            return DateTime.Now.AddSeconds(TotalSeconds);
        }

        /// <summary>
        /// Cookies过期时间
        /// </summary>
        /// <returns></returns>
        public static DateTime GetCookiesExpires()
        {
            return DateTime.Now.AddSeconds(TotalSeconds);
        }
    }
}
